/**
 * 初始化 App
 * 应保证此模块是 app 中最先被载入的
 */
import { StrictMode } from 'react'
import { createRoot } from 'react-dom/client'

import './global'
import './logging'
import './dayjs'

export function renderApp(App: () => JSX.Element | null) {
  function WrappedApp() {
    return <StrictMode>
      <App />
    </StrictMode>
  }

  const rootElement = document.createElement('div')
  document.body.appendChild(rootElement)
  rootElement.id = 'root'

  createRoot(rootElement).render(<WrappedApp />)
}
